﻿<%@ Page Title="系统用户管理" Language="C#" MasterPageFile="~/Shared/FormPage.Master" AutoEventWireup="true" CodeBehind="UserAdd.aspx.cs" Inherits="Runda.CMS.Portal.SysManage.UserAdd" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <link href="../Content/Tab/tabs.css" rel="stylesheet" type="text/css" /> 
 <script type="text/javascript">
    function OnTreeNodeChecked() {
         var ele = event.srcElement;
         if (ele.type == 'checkbox') {
             var childrenDivID = ele.id.replace('CheckBox', 'Nodes');
             var div = document.getElementById(childrenDivID);
             if (div == null) return;
             var checkBoxs = div.getElementsByTagName('INPUT');
             for (var i = 0; i < checkBoxs.length; i++) {
                 if (checkBoxs[i].type == 'checkbox')
                     checkBoxs[i].checked = ele.checked;
             }
         }
     } 

    </script>
 <script type="text/javascript">
     function CheckForm() {
         if (document.getElementById('<%=txtAccount.ClientID %>').value == '') {
             alert('请输入用户帐号!');
             document.getElementById('<%=txtAccount.ClientID %>').focus();
                return false;
            }

            if (document.getElementById('<%=txtPassword.ClientID %>').value == '') {
                document.getElementById('<%=txtPassword.ClientID %>').focus();
                alert('请输入密码!');
                return false;
            }

            if (document.getElementById('<%=txtPassword2.ClientID %>').value == '') {
                document.getElementById('<%=txtPassword2.ClientID %>').focus();
                alert('请输入确认密码!');
                return false;
            }

            if (document.getElementById('<%=txtPassword2.ClientID %>').value != document.getElementById('<%=txtPassword.ClientID %>').value) {
                alert('两次密码输入不一致!');
                return false;
            }
        }
        
        //用Treeview chekbox节点单选的处理事件   
    function TreeSingleSelect(treeID, checkNode) {
        if (!treeID || treeID.value != 'ctl00_cphFormArea_treeDepartment')   
            return;   
        var objs = document.getElementsByTagName("input");   
        for (var i = 0; i < objs.length; i++) {   
            if (objs[i].type == 'checkbox') {   
                var obj = objs[i];   
                if (obj.id.indexOf(treeID) != -1) {   
                    if (obj != checkNode) {   
                        obj.checked = false;   
                    }   
                }   
            }   
        }   
    }   
    //用于给TreeView的 chebox添加 单击事件(如果要将某一TreeView变为单选择 只需调用下面方法)
    function SetTreeNodeClickHander(treeID) {
        if (treeID.value != 'ctl00_cphFormArea_treeDepartment') { return; }  
        var objs = document.getElementsByTagName("input");   
        for (var i = 0; i < objs.length; i++) {   
            if (objs[i].type == 'checkbox') {   
                var obj = objs[i];   
                if (obj.id.indexOf(treeID) != -1) {   
                    objs[i].onclick = function() { TreeSingleSelect(treeID, this); };   
                }   
            }   
        }   
    }
 </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cphFormArea" runat="server">
   <table class="mnubar" cellspacing="0" cellpadding="0">
        <tbody>
            <tr>
                <td width="9">
                    <img hspace="3" src="../Content/Menu/mnu_vSpacer.gif">
                </td>
                <td class="icMenu" nowrap>
                    <asp:LinkButton ID="lnkbtnSave" runat="server" onclick="lnkbtnSave_Click" OnClientClick="return CheckForm();"><span class="menu" title="保存"><img class="mnuBtn" src="../Content/Menu/Save_16_blue.gif"><span class="mnuBtn">保存</span></span></asp:LinkButton>
                    <asp:LinkButton ID="lnkbtnSaveAndClose" runat="server" onclick="lnkbtnSaveAndClose_Click" OnClientClick="return CheckForm();"><span class="menu" title="保存&amp;关闭" onclick="window.execScript(this.action);"><img class="mnuBtn" src="../Content/Menu/SaveClose_16_blue.gif"><span class="mnuBtn">保存&amp;关闭</span></span></asp:LinkButton>
                    <asp:LinkButton ID="lnkbtnSaveAndNew" runat="server" onclick="lnkbtnSaveAndNew_Click" OnClientClick="return CheckForm();"><span class="menu" title="保存&amp;新增"><img class="mnuBtn" src="../Content/Menu/SaveNew_16_blue.gif"><span class="mnuBtn">保存&amp;新增</span></span></asp:LinkButton>
                    <img src="../Content/Menu/separator.gif">
                    <span class="menu" title="关闭" onclick="window.close();"><img class="mnuBtn" src="../Content/Menu/Close_16_blue.gif"><span class="mnuBtn">关闭</span></span>
                </td>
            </tr>
        </tbody>
    </table>
   
   <div style="border-bottom: #c2c2bf 1px solid; border-top: #969693 1px solid"></div>
   
    <div id="areaForm" class="area">
        <table cellspacing="0" cellpadding="0" width="100%" height="100%">
            <tbody>
                <tr height="25">
                    <td>
                        <table class="tabBar" cellspacing="0" cellpadding="0">
                            <tbody>
                                <tr>
                                    <td id="appForm_tabs" valign="bottom" nowrap>
                                        <SPAN    class="tab tabOn" tabIndex=0   tabID="appForm_tab0">基本资料</SPAN><SPAN class=tab tabIndex=0   tabID="appForm_tab1">用户角色</SPAN><span class="tab" tabindex=0 tabID="appForm_tab2">所属部门</span><span class="tab" tabindex=0 tabID="appForm_tab3">数据权限</span><span class="tab" tabindex=0 tabID="appForm_tab4">产品权限</span>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                        <hr id="appForm_hrSelectedTab" class="tabGlow">
                        <hr id="appForm_hrGlowTab" class="tabGlow">
                    </td>
                </tr>
                <tr>
                    <td valign="top">
                        <div style="display: inline" id="appForm_tab0" class="tab">
                            <table style="table-layout: fixed" id="Section1" cellspacing="0" cellpadding="3" width="100%">
                                <colgroup>
                                    <col width="60">
                                    <col>
                                    <col width="60">
                                    <col>
                                    </colgroup>
                                    <tbody>
                                        <tr>
                                            <td class="req">
                                                用户帐号
                                            </td>
                                            <td>
                                                <asp:TextBox ID="txtAccount" runat="server" CssClass="input" MaxLength="20"></asp:TextBox> 
                                            </td>
                                            <td>姓名</td>
                                            <td><asp:TextBox ID="txtUserName" runat="server" CssClass="input" MaxLength="20"></asp:TextBox> </td>
                                        </tr>                                       
                                         <tr>
                                            <td class="req">密码
                                            </td>
                                            <td><asp:TextBox ID="txtPassword" runat="server" CssClass="input"  MaxLength="20"
                                                    TextMode="SingleLine" Enabled="false" Text="******"></asp:TextBox> 
                                             </td>
                                              <td class="req">确认密码
                                            </td>
                                            <td><asp:TextBox ID="txtPassword2" runat="server" CssClass="input" MaxLength="20"
                                                    TextMode="SingleLine" Enabled="false" Text="******"></asp:TextBox> 
                                             </td>
                                        </tr>          
                                        <tr>   
                                            <td>是否业务员</td>
                                              <td>
                                            <asp:DropDownList ID="ddlIsSaleor" runat="server">
                                                <asp:ListItem Text="否" Value="0"></asp:ListItem>
                                                <asp:ListItem Text="是" Value="1"></asp:ListItem>                                            
                                            </asp:DropDownList>
                                            </td>
                                            <td>是否经理/组长</td>
                                            <td>
                                                    <asp:DropDownList ID="ddlIsManager" runat="server">
                                                <asp:ListItem Text="否" Value="0"></asp:ListItem>
                                                <asp:ListItem Text="是" Value="1"></asp:ListItem>                                            
                                            </asp:DropDownList>
                                            </td>
                                        </tr>
                                         <tr>
                                            <td>邮箱
                                            </td>
                                            <td>
                                                <asp:TextBox ID="txtEmail" runat="server"></asp:TextBox>
                                            </td>
                                            <td class="req">所在部门
                                            </td>
                                           <td  >
                                                <asp:Label ID="lblDept" runat="server"></asp:Label>
                                            </td>
                                         
                                          
                                        </tr>     
                                    </tbody>
                            </table>
                        </div>
                      <div id=appForm_tab1 class=tab>
                         <table style="table-layout: fixed" id="Table1" cellspacing="0" cellpadding="3" width="100%">
                                <colgroup>
                                    <col width="60">
                                    <col>
                                    <col width="60">
                                    <col>
                                    <tbody>
                                        <tr>
                                            <td class="req">
                                                选择角色
                                            </td>
                                            <td>
                                                <asp:CheckBoxList ID="cblRoles" runat="server">
                                                </asp:CheckBoxList>
                                            </td>                                            
                                        </tr>                                         
                                    </tbody>
                            </table>
                      </div>
                       <div id=appForm_tab2 class=tab>
                            <table style="table-layout: fixed" id="Table2" cellspacing="0" cellpadding="3" width="100%">
                                <colgroup>
                                    <col width="60">
                                    <col>
                                    <col width="60">
                                    <col>
                                    <tbody>
                                        <tr>
                                            <td class="req">
                                                选择部门
                                            </td>
                                            <td> <asp:TreeView ID="treeDepartment" runat="server" ShowCheckBoxes="All" 
                                                        ShowLines="True" PopulateNodesFromClient="False">
                                                    </asp:TreeView> 
                                            </td>                                            
                                        </tr>                                         
                                    </tbody>
                            </table>
                      </div>
                       <div id=appForm_tab3 class=tab>
                            <table style="table-layout: fixed" id="Table3" cellspacing="0" cellpadding="3" width="100%">
                                <colgroup>
                                    <col width="60">
                                    <col>
                                    <col width="60">
                                    <col>
                                    <tbody>
                                        <tr>
                                            <td class="req">
                                                选择部门
                                            </td>
                                            <td> <asp:TreeView ID="treeDepartmentDataRight" runat="server" ShowCheckBoxes="All" 
                                                        ShowLines="True" PopulateNodesFromClient="False">
                                                    </asp:TreeView> 
                                            </td>                                            
                                        </tr>                                         
                                    </tbody>
                            </table>
                      </div>
                      <div id=appForm_tab4 class=tab>
                            <table style="table-layout: fixed" id="Table4" cellspacing="0" cellpadding="3" width="100%">
                                <colgroup>
                                    <col width="60">
                                    <col>
                                    <col width="60">
                                    <col>
                                    <tbody>
                                        <tr>
                                            <td class="req">
                                                选择产品分类
                                            </td>
                                            <td> <asp:TreeView ID="treeProductCategory" runat="server" ShowCheckBoxes="All" 
                                                        ShowLines="True" PopulateNodesFromClient="False">
                                                    </asp:TreeView> 
                                            </td>                                            
                                        </tr>                                         
                                    </tbody>
                            </table>
                      </div>
                    </td>
                </tr>
            </tbody>
        </table>
    </div> 
    <script type="text/javascript">
        //SetTreeNodeClickHander("<%=treeDepartment.ClientID%>");   

    </script>
</asp:Content>
